package testy;

import java.util.ArrayList;
import java.util.List;
 
 
public class Question {
        private String myText;
        private String myKeywords;
        private List<Answer> myAnswers;
        private int myId;
 
        Question(String text, List<Answer> answers, int id) {
                myText = text;
                myAnswers = answers;
                myKeywords = null;
                myId = id;
        }
       
        Question(String text, String keywords, String... answers) {
                myAnswers = new ArrayList<>();
                for(String a : answers) {
                        myAnswers.add(new Answer(a));
                }
               
                myText = text;
                myKeywords = keywords;
        }
       
        public String toString() {
                StringBuilder sb = new StringBuilder();
               
                sb.append(myText + "(" + myAnswers.size() + ")\n");
               
                if (myAnswers.isEmpty()) {
                        sb.append("\tNo known answers.\n");
                }
               
                for (Answer a : myAnswers) {
                        sb.append("\t" + a.toString() + "\n");
                }
               
                return sb.toString();
        }
 
        public String getText() {
                return myText;
        }
 
        public void setText(String myText) {
                this.myText = myText;
        }
 
        public List<Answer> getAnswers() {
                return myAnswers;
        }
 
        public void setAnswers(List<Answer> myAnswers) {
                this.myAnswers = myAnswers;
        }
       
        public int getId() {
                return myId;
        }
 
        public void setId(int myId) {
                this.myId = myId;
        }
       
}
